<!DOCTYPE html>
<html lang="en">
<head>
    <{include file="header.html"}>
    <title>组卷管理-<{$user_data['school_name']}>-德安信会计在线教育平台</title>
</head>
<body>
<div class="wrap">
    <!--star left-->
    <div class="column">
        <{include file="left_menu.html"}>
    </div>
    <div id="ContMianBox">
        <!--star子栏目-->
        <div class="sub-colum">
                <div class="tit"><{$left_menu_min.menu}></div>
                <ul>
                    <{foreach from=$left_menu_min.list item=item}>
                    <li <{if $item['url'] == $left_menu_min.curr}>class="curr"<{/if}>><a href="<{$item['url']}>"><{$item['name']}></a></li>
                    <{/foreach}>
                </ul>
            </div>
        <!--end子栏目-->
        <!--end left-->
        <div class="container narrow">
            <!--star conter-->
            <div class="cetContent">
                <div class="tit p-lr20">
                    <span class="curr">做题历史</span>
                </div>
                <!--star内容区域-->
                <div class="mainScroll">
                    <div class="mainContainer line-all">
                        <!--star tabMainCont-->
                        <form class="form-horizontal layui-form layui-form-pane" method="post" action="/classes/save_home_work">
							<{foreach from=$test_volume_data item=item key=key}>
							<input type="hidden" name="<{$key}>" value="<{$item}>" >
							<{/foreach}>
							<br/><br/>
							<blockquote class="layui-elem-quote" style="font-size: 20px;">
							<p>
							<{if $test_volume_data.status == 0 }>
							<span style="color:red">本次考试尚未交卷，无法计算考试结果</span>
							<{else}>
							本次答题从 <span style="color:red"><{$test_volume_data.begin_time|date_format:'%Y-%m-%d %H:%M:%S'}></span> 至 <span style="color:red"><{$test_volume_data.end_time|date_format:'%Y-%m-%d %H:%M:%S'}></span>、 耗时共：<span style="color:red"><{($test_volume_data.end_time - $test_volume_data.begin_time)|changeTimeType}></span>、得分：<span style="color:red"><{$test_volume_data.fraction}></span>分、正确率：<span style="color:red"><{$test_volume_data.right_percentage}>%</span>
							<{/if}>
							</p>
							
								<{foreach from=$topic_type_analys key=key item=item1}>
								<p style="padding: 10px 0;">
								<{$item1.name}>(共<{$topic_list[$key]|count|default:0}>题)：答对：<{$item1.right_num}>题，答错：<{$item1.wrong_num}>题，得分：<{$item1.fraction}>分
								</p>
								<{/foreach}>
							
						</blockquote>
							<{foreach from=$topic_list item=topic key=tkey}>
								<blockquote class="layui-elem-quote" style="font-size: 20px;">
								<{if $tkey == 1}>单选题<{/if}>
								<{if $tkey == 2}>多选题<{/if}>
								<{if $tkey == 3}>判断题<{/if}>
								<{if $tkey == 4}>计算分析题<{/if}>
								<{if $tkey == 7}>不定向选择题<{/if}>
								<{if $tkey == 8}>名词解释<{/if}>
								<{if $tkey == 9}>简答题<{/if}>
								 共<{$topic|count}>题
								</blockquote>
								
						  		<{foreach from=$topic item=topic_info name=foo}>
					  			<blockquote class="layui-elem-quote layui-quote-nm">
									<h1 style="font-size: 16px;font-weight: bold; "><{$smarty.foreach.foo.iteration}>.<{$topic_info.subject_text|strip_tags}></h1>
									<hr>
									<{assign var="right_topics" value=""}>
									<{if $tkey != 4}>
									<{foreach from=$topic_info.result item=result key=key}>
										<p style="padding:6px 0;">
										<{if $tkey == 1 || $tkey == 3}><input type="radio" title="<{$letter[$key]}>" disabled <{if $result.is_right == 1}>checked<{/if}>/><{/if}>
										<{if $tkey == 2}><input type="checkbox" disabled <{if $result.is_right == 1}>checked<{/if}>/><{/if}>
											<{$result.answer_text}>
											
											<{if $result.is_right == 1}>
												<{$right_topics = $right_topics|cat:$letter[$key]|cat:"、"}>
											<{/if}>
										</p>
									<{/foreach}>
									<{if $topic_info.type == 8 || $topic_info.type == 9}>
									<p style="color:#000; padding:16px 0;"><span style="font-weight: bold;color:">TA的答案：</span>
										<{$topic_info.user_answer.user_answers}>
									</p>
									<{else}>
									<p style="color:green; padding:16px 0;"><span style="font-weight: bold;">正确答案：</span><{$right_topics|mb_substr:0:-1}></p>
									<p style="color:#000; padding:16px 0;"><span style="font-weight: bold;">TA的答案：</span>
										<{foreach from=$topic_info.result item=result key=key}>
										<{if $result.id|in_array:$topic_info.user_answer}>
											<{assign var="user_right_topics" value=""}>
											<{$user_right_topics = $user_right_topics|cat:$letter[$key]|cat:"、"}>
											<{$user_right_topics|mb_substr:0:-1}>
										<{/if}>
										<{/foreach}>
									</p>
									<{/if}>
									<{else}>
										<{foreach from=$topic_info.result key=k item=item}>
											<{foreach from=$item key=k item=analys_item}>
											<div class="layui-tab-item layui-show">
												<div class="layui-form-item layui-form-text">
													<div class="layui-input-block">
														<{$k+1}>、<{$analys_item.subject_text|strip_tags}>
													</div>
												</div>
												
												<{if $analys_item.analys_type == 1}>
												<div class="layui-form-item tk_answer">
													<div class="layui-inline">
														<label class="layui-form-label">子题干答案</label>
														<div class="layui-input-block">
															<input type="text" name="analys[<{$analys_item.answer_list[0].aid}>][<{$analys_item.answer_list[0].id}>][answer_text]" value="<{$analys_item.answer_list[0].answer_text}>" disabled autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
												</div>
												<{else}>
												<{foreach from=$analys_item.answer_list key=k item=analys_result}>
												<div class="layui-form-item fl_answer">
													<div class="layui-inline">
														<label class="layui-form-label">借贷方向</label>
														<div class="layui-input-block">
															<select disabled name="analys[<{$analys_result.aid}>][<{$analys_result.id}>][type]">
																<option value="1" <{if $analys_result.type == 1}>selected<{/if}>>借</option>
																<option value="2" <{if $analys_result.type == 2}>selected<{/if}>>贷</option>
															</select>
														</div>
													</div>
													<div class="layui-inline">
														<label class="layui-form-label">选择科目</label>
														<div class="layui-input-block">
															<input type="hidden" class="accounts" name="analys[<{$analys_result.aid}>][<{$analys_result.id}>][topic_subject_id]" >
															<input type="text" autocomplete="off" style="width:200px;" class="layui-input" value="<{$analys_result.topic_subject_title}>" disabled onclick="choice_accounts(this)">
														</div>
													</div>
													<div class="layui-inline">
														<label class="layui-form-label">答案</label>
														<div class="layui-input-block">
															<input type="text" style="width:145px;" name="analys[<{$analys_result.aid}>][<{$analys_result.id}>][answer_text]" value="<{$analys_result.answer_text}>" disabled autocomplete="off" class="layui-input">
														</div>
													</div>
												</div>
												<{/foreach}>
												<{/if}>

										    </div>
										<{/foreach}>
									<{/foreach}>
									
									<fieldset class="layui-elem-field" style="background-color: #fafafa;color: #999;">
									<legend>TA的答案</legend>
									<div class="layui-field-box">
									<{foreach from=$topic_info.result key=k item=item}>
										<{foreach from=$item key=k item=analys_item}>

											<div class="layui-tab-item layui-show">
												<div class="layui-form-item layui-form-text">
													<div class="layui-input-block">
														<{$k+1}>、<{$analys_item.subject_text}>
													</div>
												</div>
												
												<{if $analys_item.analys_type == 1}>
												<div class="layui-form-item tk_answer">
													<div class="layui-inline">
														<label class="layui-form-label">子题干答案</label>
														<div class="layui-input-block">
															<input type="text" name="" value="<{if !empty($analys_item.user_answer_list[$analys_item.answer_list[0].id])}><{$analys_item.user_answer_list[$analys_item.answer_list[0].id]['answer_text']}><{/if}>" disabled autocomplete="off" class="layui-input" style="width: 500px;">
														</div>
													</div>
												</div>
												<{else}>
												<{foreach from=$analys_item.answer_list key=k item=analys_result}>
												<div class="layui-form-item fl_answer">
													<div class="layui-inline">
														<label class="layui-form-label">借贷方向</label>
														<div class="layui-input-block">
															<select disabled name="">
																<option value="1" <{if !empty($analys_item.user_answer_list[$analys_item.answer_list[$k].id]) AND $analys_item.user_answer_list[$analys_item.answer_list[$k].id]['type'] == 1}>selected<{/if}>>借</option>
																<option value="2" <{if !empty($analys_item.user_answer_list[$analys_item.answer_list[$k].id]) AND $analys_item.user_answer_list[$analys_item.answer_list[$k].id]['type'] == 2}>selected<{/if}>>贷</option>
															</select>
														</div>
													</div>
													<div class="layui-inline">
														<label class="layui-form-label">选择科目</label>
														<div class="layui-input-block">
															<input type="hidden" class="accounts" name="" >
															<input type="text" autocomplete="off" style="width:200px;" class="layui-input" value="<{if !empty($analys_item.user_answer_list[$analys_item.answer_list[$k].id])}><{$analys_item.user_answer_list[$analys_item.answer_list[$k].id]['topic_subject_id']|get_topic_subject}><{/if}>" disabled onclick="choice_accounts(this)">
														</div>
													</div>
													<div class="layui-inline">
														<label class="layui-form-label">答案</label>
														<div class="layui-input-block">
															<input type="text" style="width:145px;" name="" value="<{if !empty($analys_item.user_answer_list[$analys_item.answer_list[$k].id])}><{$analys_item.user_answer_list[$analys_item.answer_list[$k].id]['answer_text']}><{/if}>" disabled autocomplete="off" class="layui-input">
														</div>
													</div>
												</div>
												<{/foreach}>
												<{/if}>

										    </div>
										<{/foreach}>
									<{/foreach}>
									</div>
									</fieldset>
									<!-- <fieldset class="layui-elem-field" style="background-color: #fafafa;color: #999;">
									<legend>TA的答案</legend>
									<div class="layui-field-box">
									<{foreach from=$topic_info.result key=k item=item}>
										<{foreach from=$item key=k item=analys_item}>
										<p>子题目<{$k+1}>、</p>
										<{if $analys_item.analys_type == 1}>
											<p style="color:red; padding:16px 0;"><span style="font-weight: bold;color: #000;">子题干答案：<{$analys_item.answer_list[0].answer_text}>
											</span></p>
										<{else}>
											<{foreach from=$analys_item.user_answer_list item=user_answer}>
											<p style="color:red; padding:16px 0;">
											<{if !empty($user_answer.type)}>
											<span style="font-weight: bold;color: #000;">借贷方向：借</span>
											<{else}>
											<span style="font-weight: bold;color: #000;">借贷方向：贷</span>
											<{/if}>
											&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<{if !empty($user_answer.topic_subject_id)}>
											<span style="font-weight: bold;color: #000;">科目：<{$user_answer.topic_subject_id|get_topic_subject}></span>
											<{else}>
											<span style="font-weight: bold;color: #000;">科目：未选择</span>
											<{/if}>
											&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<{if !empty($user_answer.answer_text)}>
											<span style="font-weight: bold;color: #000;">答案：<{$user_answer.answer_text}></span>
											<{else}>
											<span style="font-weight: bold;color: #000;">答案：未填写</span>
											<{/if}>
											</p>
											<{/foreach}>
										<{/if}>
										<{/foreach}>
									<{/foreach}>
									</div>
									</fieldset> -->
									
									<{/if}>
									<fieldset class="layui-elem-field" style="background-color: #fafafa;color: #999;">
									  	<legend>答题解析</legend>
									  	<div class="layui-field-box">
									    <p style="font-weight: bold;"><{$topic_info.analysis}></p>
									  </div>
									</fieldset>
									<{if $topic_info.type == 8 || $topic_info.type == 9}>

									<div class="fraction_box" topic_type="<{$topic_info.type}>" topic_id="<{$topic_info.id}>" fraction="<{$template_content[$topic_info.type]['fraction']}>">
										<div class="layui-form-item">
											<label class="layui-form-label">得分</label>
											<div class="layui-input-block">
												<input type="text" name="fraction" value="<{if $topic_info.user_answer.fraction > 0}><{$topic_info.user_answer.fraction}><{/if}>" autocomplete="off" class="layui-input fraction" style="width: 50px;">
											</div>
										</div>
										<div class="layui-form-item">
											<label class="layui-form-label">评语</label>
											<div class="layui-input-block">
												<textarea class="layui-textarea feedback" name="feedback" style="width: 500px;"><{$topic_info.user_answer.feedback}></textarea>
											</div>
										</div>

										<div class="layui-form-item">
											<div class="layui-input-block">
												<a class="layui-btn gaijuan" lay-submit="">立即提交</a>
											</div>
										</div>
									</div>
									<{/if}>
								</blockquote>
								<{/foreach}>
							<{/foreach}>
						</form>
                        <!--star会员管理-->
                    </div>
                    <!--end tabMainCont-->
                </div>
            </div>
        </div>
    </div>
</div>
<{include file="footer.html"}>
<script>
	$(function(){
		$(".gaijuan").click(function(){
			var element = $(this).closest(".fraction_box");
			var topic_id = element.attr("topic_id");
			var topic_type = element.attr("topic_type");
			var fraction = parseFloat(element.find(".fraction").val());
			var feedback = element.find(".feedback").val()
			if(isNaN(fraction)){
				alert("得分只能输入数字");
				return false;
			}
			
			if(fraction > element.attr("fraction")){
				alert("本题最多只能给"+element.attr("fraction")+"分");
				return false;
			}

			$.ajax({
				type: "POST",
				url:  "/classes/mark_volume",
				data: "topic_id="+topic_id+"&fraction="+fraction+"&feedback="+feedback+"&volume_history_id=<{$home_work_history_id}>",
				async: false,
				dataType: "json",
				success: function(data){
					if(data == 1){
				  		alert("批改成功")
					}else if(data == 3){
						alert("学生未作答，无法批改该题目");
					}else{
						alert("批改失败");
					}
					
				}
			});
		})
	})
</script>
</body>
</html>
